package com.project.mapper;

import com.project.bean.MessageBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface IMessageMapper {
    @Insert("INSERT INTO t_message(m_name,m_phone,m_job)VALUES" +
            "(#{name},#{phone},#{job})")
    void add(MessageBean mess);

    @Delete("delete from t_message where pk_messageId=#{id}")
    void del(int id);

    @Update("update t_message set m_phone=#{phone} where pk_messageId=#{id}")
    void update(@Param("id") int id, @Param("phone") String phone);

    List<MessageBean> findByItem(@Param("name") String name, @Param("job") String job);

    @Select("select * from t_message where pk_messageId=#{id}")
    @ResultMap("messMap")
    MessageBean findById(int id);
}
